﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace JerrodSoft.Tests
{
    [TestClass]
    public class XsdSerializationTests
    {
        private readonly JerrodSoft.Serialization.Xml.XsdSerializer Serializer = new Serialization.Xml.XsdSerializer();

        [TestMethod]
        public void TestPrimitiveSerialize()
        {
            var value = Serializer.Serialize(typeof(TestClasses.ClassWithAllPrimitiveTypes));
            Console.WriteLine(value);
            Assert.IsTrue(true);
        }

        [TestMethod]
        public void TestParentChildNestedClass()
        {
            var value = Serializer.Serialize(typeof(TestClasses.NestedParentClass));
            Console.WriteLine(value);
            Assert.IsTrue(true);
        }

        [TestMethod]
        public void TestMultiTypeSerialization()
        {
            var value = Serializer.Serialize(typeof(TestClasses.NestedParentClass), typeof(TestClasses.ClassWithAllPrimitiveTypes));
            Console.WriteLine(value);
            Assert.IsTrue(true);
        }

        [TestMethod]
        public void TestAnonymousTypeSerialization()
        {
            var x = new { A = 1, B = "hello", C = 12.1 };
            var nX = new { AA = 12312312 };
            var nXX = new
            {
                Z = 1,
                Zz= new {
                    Something = 1,
                    OtherStuff = "asdfasdfa"
                }
            };
            var value = Serializer.Serialize(x.GetType());
            Console.WriteLine(value);
            Assert.IsTrue(true);
        }
    }
}
